Cisco Commands
Router Initial configuration Hostname Router# configure terminal Router(Config)# hostname name Passwords '' Router(Config)#enable password Password Router(Config)#enable secret Password ''Line vty 0-4 '' Router(Config)#line vty 0 Router(Config-if)#password Password Router(Config-if)#Login Router(Config-if)#exit ''Line console 0-4 Router(Config)#line console 0 Router(Config-if)#password Password Router(Config-if)#login Router(Config-if)#exit Password encryption Router(Config)#service password-encryption ( Router#copy run start ) Interface Configuration: Interfaces: Fastethernet Router(Config)# interface fastethernet 0/0 Router(Config-if)#description line Router(Config-if)#ip address address Subnemask Router(Config-if)#no shutdown Serial Router(Config)#interface serial 0/0/0 Router(Config-if)#description line Router(Config-if)#ip address address Subnetmask Router(Config-if)#no shutdown Clock rate Router(Config)#interface serial 0/0/0 Router(Config-if)#clock rate ? Router(Config-if)#clock rate [ clock rate speed ] Encapsulation PPP Router(Config)#interface serial 0/0/0 Router(Config-if)#encapsulation ppp ( Router#copy run start ) Router configuration options Ip Route: Default Router(Config)#interface serial 0/0/0 Router(Configure-if)#ip route 0.0.0.0 0.0.0.0 address Static Router(Config)#interface serial 0/0/0 Router(Config-if)#ip route address Subnetmask address RIP Router(Config)# router rip Router(Config-router)#version 2 Router(Config-router)#network networknumber NAT: inside Router(config)#interface fastethernet 0/0 Router(config-if)#ip address address subnetmask Router(config-if)#ip nat inside Router(config-if)#no shutdown outside Router(config)#interface fastethernet 0/0 Router(config-if)#ip address address subnetmask Router(config-if)#ip nat outside Router(config-if)#no shutdown Router(config)#ip nat inside source static address address *comment: inside Ip address is translated to external ip address * DHCP: Router(config)# Router(config)# ip dhcp pool poolname Router(dhcp-config)# network network subnetmask Router(config)#ip dhcp excluded-address address ( OR address address) *comment: between ip address and ip address* Router(dhcp-config)#default-router address { Router(dhcp-config)#domain-name name Router(dhcp-config)#dns-server address Router(dhcp-config)#lease {days hours minutes infinite} } (Router#copy run start ) Other Router Commands Basic Router commands Showing credentials Router#show run OR Router(config)#do show run Router#show ip nat translations OR Router(config)#do show ip nat translations * The output displays the detailed NAT assignments. The command shows all static translations that have been configured and any dynamic translations that have been created by traffic* Router#show ip nat statistics OR Router(config)#do show ip nat statistics * The show ip nat statistics command displays information about the total number of active translations, NAT configuration parameters, how many addresses are in the pool, and how many have been allocated.* Saving/Restoring Router#copy run start * copy the running-configuration to the startup-configuration file to ensure that the restored configuration is saved* Router#copy startup-config tftp OR Router#copy running-config tftp * files can be saved to a network server is using TFTP. The TFTP server must be accessible to the router via a network connection.* Banner Router(config)#banner motd cline herec *cUnautorized Access Prohibitedc* example Ping Router#ping address Router(config)#ping address Router#ping or websitename Router(config)# ping or websitename Router(config)#traceroute ip address CMD PC>Tracert address or name Switch Switch configuration Initial configuration: Hostname Switch#config terminal Switch(config)#hostname hostname Passwords Switch(config)#enable password Switch(config)#enable secret [password Line vty 0-4 Switch(config)#line vty 0 Switch(config-if)#password password Switch(config-if)#login Switch(config-if)#exit Line console 0-4 Switch(config)#line console 0 Switch(config-if)#password password Switch(config-if)#login Switch(config-if)#exit Password encryption Switch(config)# service password-encryption ( Switch#copy run start )   Interface configuration Vlan1 Switch(config)#interface vlan1 Switch(config-if)#ip address address subnetmask Switch(config-if)#no shutdown Switch(config-if)#exit Default gateway Switch(config)#ip default-gateway address Security Static Switch(config)#interface fastethernet 0/0 Switch(config-if)#switchport mode access Switch(config-if)#switchport port-security Switch(config-if)#switchport mac-address address Switch(config-if)#exit Dynamic Switch(Config)#interface fastethernet 0/0 Switch(Config-if)#port mode access Switch(Config-if)#swtichport port –security Switch(Configure-if)#exit Sticky Switch(Configure)#interface fastethernet 0/0 Switch(Config-if)#switchport mode access Switch(Config-if)#switchport port-security Switch(Config-if)#switchport port-security maximum 50 Switch(Config-if)#switchport port-security mac-address sticky Switch(Config-if)#exit (Switch# copy run start )   Other Switch Commands Show credentials Switch#show run Switch#show port-security interface Switch#show port-security Switch#show port-security address Switch#show cdp neighbors Switch#show cdp neighbors detail Removing security credentials from a interface Switch(config)#interface fastethernet 0/0 Switch(config-if)#clear port-security sticky interface number Switch(config)#interface fastethernet 0/0 Switch(config-if)# no switchport port-security Reset mac security Switch(config)#interface fastethernet 0/0 Switch(config-if)#clear port-security Switch(config-)#interface fastethernet 0/0 Switch(config-if)#Clear port-security interface fa 0/0 access Activate or Deactivate a switchport Switch(config)interface fastethernet 0/0 Switch(config-if)#no shutdown Switch(config)interface fastethernet 0/0 Switch(config-if)#shutdown Saving Switch#copy run start Switch#copy start tftp Category:Cisco